//排序算法测试

#include <iostream>
#include "bubblesort.h"
#include "insertionsort.h"
#include "shellsort.h"
#include "quicksort.h"
#include "selectionsort.h"
#include "heapsort.h"
#include "mergesort.h"



using namespace std;

void print(int a[], int n)
{
    for (int i = 0; i < n; i++)
    cout << a[i] << ' ';
    cout << endl;
}

void reset(int a[], int n, int v[])
{
    for(int i = 0; i < n; i++)
    a[i] = v[i];
}

int main()
{
    const int n = 10;
    int v[n] = {3,1,4,1,5,9,2,6,5,3};
    int a[n];

    cout << "BubbleSort:" << endl;
    reset(a, n, v);
    print(a, n);
    BubbleSort(a, n);
    print(a, n);

    cout << "InsertionSort:" << endl;
    reset(a, n, v);
    print(a, n);
    InsertionSort(a, n);
    print(a, n);

    cout << "ShellSort:" << endl;
    reset(a, n, v);
    print(a,n);
    ShellSort(a,n);
    print(a, n);

    cout << "QuickSort:" << endl;
    reset(a, n, v);
    print(a, n);
    QuickSort(a, n);
    print(a, n);

    cout << "SelectionSort:" << endl;
    reset(a, n, v);
    print(a, n);
    SelectionSort(a, n);
    print(a, n);

    cout << "HeapSort:" << endl;
    reset(a, n, v);
    print(a, n);
    HeapSort(a, n);
    print(a, n);

    cout << "MergeSort:" <<endl;
    reset(a, n, v);
    print(a, n);
    MergeSort(a, n);
    print(a, n);

    return 0;
}